package structural.composite;

import java.util.List;

/**
 * @ClassName: Leaf
 * @Description: 叶子节点（LeafNode）
 * @Author: liu-hao
 * @Date: 2023-04-09 17:51
 * @Version: 1.0
 **/
public class Leaf implements Component {
    private String name;

    public Leaf(String name) {
        this.name = name;
    }

    @Override
    public void add(Component c) {
    }

    @Override
    public void remove(Component c) {
    }

    @Override
    public List<Component> getChildren() {
        return null;
    }

    @Override
    public void operation() {
        System.out.println("树叶" + name + "：被访问！");
    }
}
